from urllib.request import *
from urllib.parse import *
from fake_useragent import *

# 关于post请求的获取
# 登录的案例

url = "https://www.w3cschool.cn/checklogin_1"

form_data = {
    "username": "username",
    "password": "password"
}

headers = {
    "User-agent": UserAgent().chrome
}
request = Request(url, data=urlencode(form_data).encode(), headers=headers)
response = urlopen(request)
print(response.read().decode())
